import Vue from 'vue'
import VueRouter from 'vue-router'
// import store from '../store/login.js'
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    component: () => import('@/page/index/index.vue'),
  },
  {
    path: '/category',
    name: 'category',
    meta: { title: '' },
    component: () => import('@/page/index/category/index.vue')
  },
  {
    path: '/proguct/:id',
    component: () => import('@/page/index/progouct/index.vue'),
  },
  {
    path: '/login',
    component: () => import('@/page/login/index.vue')
  },
  {
    path: '/cart',
    component: () => import('@/page/index/Cart.vue')
  },
  {
    path: '/demo',
    component: () => import('@/views/Layout.vue')
  },
  {
    path: '/city',
    component: () => import('@/views/index.vue')
  }
]

const router = new VueRouter({
  routes
})

// router.beforeEach((to, from, next) => {
//   // let token = store.state.login.logo.token
//   // console.log(token);
//   // if (to.path == "/cart") {
//   //   if (store.state.login.logo.token) {
//   //     next()
//   //   } else {
//   //     next('/login')
//   //   }
//   // }
// })

router.afterEach((to, from) => {
  console.log(to);
  console.log(from);
})

export default router
